package etp.client;

import javax.jdo.annotations.*;


@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Codigos {

	@PrimaryKey
	@Persistent
	@Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
	private String pk;
	
	@Persistent
	private int P;
	@Persistent
	private int T;
	@Persistent
	private int R;
	@Persistent
	private String codP;
	@Persistent
	private String codT;
	@Persistent
	private String codR;
	
	public Codigos() {
		
		this.P = 0;
		this.T = 0;
		this.R = 0;
		
		atualiza();
		
	}
	
	/**
	 * @param pk the pk to set
	 */
	public void setPk(String pk) {
		this.pk = pk;
	}

	/**
	 * @return the pk
	 */
	public String getPk() {
		return pk;
	}
	
	/**
	 * @return the p
	 */
	public int getP() {
		return P;
	}

	/**
	 * @param p the p to set
	 */
	public void setP(int p) {
		P = p;
	}

	/**
	 * @return the t
	 */
	public int getT() {
		return T;
	}

	/**
	 * @param t the t to set
	 */
	public void setT(int t) {
		T = t;
	}

	/**
	 * @return the r
	 */
	public int getR() {
		return R;
	}

	/**
	 * @param r the r to set
	 */
	public void setR(int r) {
		R = r;
	}

	/**
	 * @return the codP
	 */
	public String getCodP() {
		return codP;
	}

	/**
	 * @param codP the codP to set
	 */
	public void setCodP(String codP) {
		this.codP = codP;
	}

	/**
	 * @return the codT
	 */
	public String getCodT() {
		return codT;
	}

	/**
	 * @param codT the codT to set
	 */
	public void setCodT(String codT) {
		this.codT = codT;
	}

	/**
	 * @return the codR
	 */
	public String getCodR() {
		return codR;
	}

	/**
	 * @param codR the codR to set
	 */
	public void setCodR(String codR) {
		this.codR = codR;
	}
	
	/**
	 * 
	 */
	 public void atualiza(){
		 
		this.codP = "P" + P;
		this.codR = "R" + R;
		this.codT = "T" + T;
		
	 }
	 
	 public void incP(){
		 setP(P+1);
		 atualiza();
	 }
	 public void incR(){
		 setR(R+1);
		 atualiza();
	 }
	 public void incT(){
		 setT(T+1);
		 atualiza();
	 }
}
